<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <title>添加商品</title>
    <style>
        body {
            background-color: #f8f1f4;
            color: #8a4a6c;
            font-family: "Segoe UI", sans-serif;
        }
        form {
            width: 600px;
            margin: 50px auto;
            padding: 25px;
            background-color: #fff5f9;
            border: 2px solid #ff99d6;
            border-radius: 10px;
            box-shadow: 0 0 20px #ffb3e0;
        }
        label {
            display: block;
            margin-bottom: 8px;
            margin-top: 10px;
        }
        input, select, textarea {
            width: 100%;
            padding: 8px;
            margin-bottom: 15px;
            background: #fff9fc;
            color: #8a4a6c;
            border: 1px solid #ffb3e0;
            border-radius: 5px;
        }
        input[type="submit"] {
            background: #ff99d6;
            color: #8a4a6c;
            border: none;
            cursor: pointer;
            font-weight: bold;
        }
        input[type="submit"]:hover {
            background: #ffb3e0;
        }
    </style>
</head>
<body>

<h2 style="text-align: center; color: #8a4a6c; text-shadow: 0 0 5px #ff99d6;">添加商品</h2>

<form action="${pageContext.request.contextPath}/goods/add" method="post">
    <label for="name">商品名称：</label>
    <input type="text" id="name" name="name" required />

    <label for="categoryId">商品分类：</label>
    <select id="categoryId" name="categoryId" required>
        <option value="">请选择分类</option>
        <c:forEach var="c" items="${categoryList}">
            <option value="${c.cid}">${c.title}</option>
        </c:forEach>
    </select>

    <label for="intro">商品介绍：</label>
    <textarea id="intro" name="intro" rows="4" required></textarea>

    <label for="price">商品价格：</label>
    <input type="number" id="price" name="price" step="0.01" required />

    <label for="stock">商品库存：</label>
    <input type="number" id="stock" name="stock" required />

    <label for="status">商品状态：</label>
    <select id="status" name="status" required>
        <option value="1">上架</option>
        <option value="0">下架</option>
    </select>

    <input type="submit" value="添加商品"/>
    <input type="button" class="btn" value="取消" onclick="window.location.href='${pageContext.request.contextPath}/goods/list'">
</form>

</body>
</html>